package risk.client.gui;

import javax.swing.JDialog;
import javax.swing.JLabel;

/**
 * TODO: Attacker dialog
 *  - Roll
 *  - Attacker dices 3 vs defender dices 2
 *  - Sydstatare vs. Nord?
 *
 * @author: Johan
 */
public class AttackWinnerDialog extends JDialog {
    private JLabel winnerLabel = new JLabel();
    final int ATTACKER = 0;
    final int DEFENDER = 1;
    
    /**
     * Create dialog
     * 
     * @author: Johan
     * @param result
     */
    public AttackWinnerDialog(int result) {
        try {
            jbInit(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * Init dialog
     * 
     * @author: Johan
     * @param result
     * @throws Exception
     */
    private void jbInit(int result) throws Exception {
        String winner = (result == ATTACKER) ? "Attacker" : "Defender";
        winnerLabel.setText("Winner is: " + winner);
        this.getContentPane().add(winnerLabel, null);
        this.setSize(200, 150);
        this.setVisible(true);
    }
}
